package com.cq.hd.member.mapper;

import com.cq.hd.member.api.dto.BusinessGroupPageDto;
import com.cq.hd.member.api.vo.BusinessGroupPageVo;
import com.cq.hd.member.po.TbBusinessGroupPo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 商家经纪人分组表 Mapper 接口
 * </p>
 *
 * @author mYunYu
 * @since 2023-12-07
 */
@Mapper
public interface TbBusinessGroupMapper extends BaseMapper<TbBusinessGroupPo> {

    List<BusinessGroupPageVo> lisBusinessGroupByDto(BusinessGroupPageDto businessGroupPageDto);

    int addNum(@Param("id") Long id, @Param("num") int num);

    int subNum(@Param("id") Long id, @Param("num") int num);

    // 根据分组id，更新分组用户数
    int updateNum(@Param("id") Long id);

    // 商家默认分组
    TbBusinessGroupPo getDefaultGroup(@Param("businessId") Long businessId);

    // 商家或者经纪人的默认分组
    TbBusinessGroupPo getBusinessOrAgentDefaultGroup(@Param("businessId") Long businessId, @Param("agentId") Long agentId);

    TbBusinessGroupPo getGroupById(@Param("id") Long id);
}
